package reactor;

import com.google.common.util.concurrent.FutureCallback;
import reactor.core.publisher.Mono;
import reactor.core.publisher.MonoSink;
import reactor.core.scheduler.Schedulers;

import java.util.concurrent.Callable;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.LongConsumer;

/**
 * 描述
 *
 * @author lgb
 * @date 2021/03/06
 **/
public class HelloMono {

    public static void main(String[] args) throws InterruptedException {
        Mono<Object> mono = Mono.create(sink -> {
            sink.success("12345");
        });
        Consumer<Object> consumer = value -> {
            System.out.println(Thread.currentThread().toString() + "," + value);
        };
        mono.subscribeOn(Schedulers.parallel()).subscribe(consumer);
        mono.subscribe(consumer);
        TimeUnit.SECONDS.sleep(10L);
    }
}
